<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>创建商品页面</title>
    <script src="js/axios.min.js"></script>
    <script src="js/jquery-1.11.3.min.js"></script>
    <script src="js/vue.js"></script>
    <script src="layui/layui.js"></script>
    <script src="js/vue-router.js"></script>
    <link rel="stylesheet" href="layui/css/layui.css"/>
    <link rel="stylesheet" href="css/goods.css"/>
    <link rel="stylesheet" href="/static/build/layui.css" media="all">
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
</head>
<body>
<blockquote class="layui-elem-quote">输入商品信息</blockquote>
<form class="layui-form" action="">
    <div class="layui-form-item">
        <label class="layui-form-label">商品类型</label>
        <div class="layui-input-block">
            <input type="text" name="title" id="type" lay-verify="title" autocomplete="off" placeholder="请输入" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">店铺编号</label>
        <div class="layui-input-block">
            <input type="text" name="username" id="eid"  required lay-verify="required" lay-reqtext="店铺编号是必填项，岂能为空？" placeholder="请输入" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">商品名称</label>
        <div class="layui-input-block">
            <input type="text" name="username" id="name" required lay-verify="required" lay-reqtext="商品名称是必填项，岂能为空？" placeholder="请输入" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">商品价格</label>
        <div class="layui-input-block">
            <input type="text" name="title" id="price" required lay-verify="title" autocomplete="off" placeholder="请输入" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">商品品牌</label>
        <div class="layui-input-block">
            <input type="text" name="title"  id="brand" lay-verify="title" autocomplete="off" placeholder="请输入" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">商品数量</label>
        <div class="layui-input-block">
            <input type="text" name="title" id="remainnum" required lay-verify="title" autocomplete="off" placeholder="请输入" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item layui-form-text">
        <label class="layui-form-label">商品属性</label>
        <div class="layui-input-block">
            <textarea placeholder="请输入内容"  id="property" class="layui-textarea"></textarea>
        </div>
    </div>
    <!--<div class="layui-form-item layui-form-text">
      <label class="layui-form-label">编辑器</label>
      <div class="layui-input-block">
        <textarea class="layui-textarea layui-hide" name="content" lay-verify="content" id="LAY_demo_editor"></textarea>
      </div>
    </div>-->
    <div class="layui-form-item">
        <div class="layui-input-block">
            <button class="layui-btn" onclick="creategood()">立即提交</button>
            <button type="reset" class="layui-btn layui-btn-primary">重置</button>
        </div>
    </div>
</form>
<script>
    function creategood()
    {
        let eid = document.getElementById("eid").value;
        let type = document.getElementById("type").value;
        let name = document.getElementById("name").value;
        let price = document.getElementById("price").value;
        let brand = document.getElementById("brand").value;
        let remainnum = document.getElementById("remainnum").value;
        let property = document.getElementById("property").value;

        $.get("http://47.94.138.204:7790/goods/addgoods", { eid: eid, type: type, name: name,price: price,brand: brand,remainnum: remainnum,property: property, },
            function(data){
                alert("Data Loaded: " + data);
            });

    }
</script>
</body>
</html>